#ifndef _TYPES_H_
#define _TYPES_H_

#include <string>

using namespace std;

#ifdef _UNICODE
# define USE_UNICODE
#endif

typedef unsigned int	uint32;
typedef unsigned char	uchar;
typedef unsigned char	byte;

#ifdef USE_UNICODE
typedef wchar_t			xchar;
typedef wstring			xstring;
#define CSTR(x)			L##x
#else
typedef char			xchar;
typedef string			xstring;
#define CSTR(x)			x
#endif

#define DECLARE_SINGLETON(TYPE)																			\
	public:																								\
	static TYPE*	instance	()				{ return ms_pInstance; }	\
	static void		setInstance	(TYPE* pInst)	{ _punisher(); ms_pInstance = pInst; }					\
	static void		destroy		()				{ delete ms_pInstance; ms_pInstance = NULL; }			\
	protected:																							\
	static TYPE*	ms_pInstance;																		\
	private:																							\
	static void		_punisher	();	

#define DEFINE_SINGLETON(TYPE)																			\
	TYPE*	TYPE::ms_pInstance = NULL;																	\
	void TYPE::_punisher() {}

#define DECLARE_SINGLETON_INHERIT(TYPE)																	\
	public:																								\
	static TYPE*	instance	()				{ return static_cast<TYPE*>(ms_pInstance); }			\
	private:

#endif